import React, {
    useEffect,
    useLayoutEffect,
    useState,
    useCallback,
    useMemo
} from "react";
import {message, Popover, Spin, Tabs } from "antd";
import {connect, useDispatch} from "react-redux";
import BtnAlert from "../../common/component/btnAlert";
import Header from "../header";
import SideBar from "../sideBar";
import axiosMethod from "../../util/axios";
import "./index.scss";

import CONFIG from "../../util/config";
import 'element-theme-default';
import "lancoo-web-ui/dist/style.css"

const {
    appAddr
} = CONFIG;
const { TabPane } = Tabs;

function Main(props){
    let {
        userInfo,
        sysAddrInfo,
        currentIdentity,
        sysInfo,
        alertInfo
    } = props;
    const dispatch = useDispatch();
    const [currentKind, setCurrentKind] = useState("notice");
    const [loadVisible, setLoadVisible] = useState(false);
    const [kindList, setKindList] = useState([
        {
            key: "todo",
            noRead: false,
            name: "待办事项"
        },
        {
            key: "notice",
            noRead: false,
            name: "通知"
        },
        {
            key: "chat",
            noRead: false,
            name: "在线交流"
        },
        {
            key: "message",
            noRead: false,
            name: "系统消息"
        }
    ])
    const [kindList2, setKindList2] = useState([]);
    const [selectList, setSelectList] = useState([]);
    const [updateKindList, setUpdateKindList] = useState([]);
    const [visible, setVisible] = useState(false);

    
    const HeaderCom = useMemo(()=>{
        return <Header />;
    }, []);
    return (
        <div className='app_main'>
            {HeaderCom}
            <SideBar />
            <BtnAlert 
            visible={alertInfo.visible} 
            title={alertInfo.title} 
            smallTitle={alertInfo.smallTitle}
            onOk={alertInfo.onOk}
            onCancel={alertInfo.onCancel} />
        </div>
    )
}
const mapProps = (state) => {
    return {
        userInfo: state.userInfo,
        sysAddrInfo: state.sysAddrInfo,
        currentIdentity: state.currentIdentity,
        sysInfo: state.sysInfo,
        alertInfo: state.alertInfo
    }
}
export default connect(mapProps)(Main);